//
//  SchoolDetailModel.swift
//  HoneyBee
//
//  Created by point on 2018/3/25.
//  Copyright © 2018年 point. All rights reserved.
//

import UIKit

class SchoolDetailModel: NSObject {
    @objc var id: Int = 0
    @objc var name: String = ""
    @objc var appointmentNum: Int = 0
    @objc var remark: String = ""
    @objc var address: String = ""
    @objc var info: String = ""
    @objc var preferential:String = ""
    @objc var phone:String = ""
    @objc var isOpen:Bool = false
    @objc var latitude:String = ""
    @objc var longitude:String = ""
    @objc var headImg:String = ""
    @objc var globalAreaCode:String = "+86"
    @objc var schoolDetailResourceModel:[SchoolDetailResourceModel] = [SchoolDetailResourceModel]()
    
    @objc var basicCellHeight: CGFloat = 0.0
    @objc var detailCellHeight: CGFloat = 100.0
    @objc var commentArr: [SchoolDetailCommentModel] = [SchoolDetailCommentModel]()
    
    @objc var collection:Bool = false
    @objc var appointment:Bool = false
    
    /// 默认不能评论
    @objc var isComment:Bool = false
    @objc var modify:Bool = false //是否是修改
    
    override init() {
        
    }
    
    override func tmReplacedKey() -> [String : String] {
        return ["schoolDetailResourceModel":"resource"]
    }
    
    override func tmStatementKey() -> [String : String] {
        return ["schoolDetailResourceModel":"ModelArr"]
    }
    
    
    func replacingHtml(_ str:String) -> String {
        do {
            let pattern = "alt=\"图片\" style=\"max-width:\\d*?px;\""
            let regex = try NSRegularExpression(pattern: pattern, options: .caseInsensitive)
            let dacaiRange = NSMakeRange(0, str.count)
            //替换
            return regex.stringByReplacingMatches(in: str, options: [], range: dacaiRange, withTemplate: "alt=\"图片\"")
        }
        catch {
            return ""
        }
    }
}


class SchoolDetailResourceModel: NSObject {
    @objc var path: String = "" //图片
    @objc var fileType: Int = 0 //0图片 1视频
}

